Attribute VB_Name = "ShareFunction"
Attribute VB_Description = "Contain all utility for Founder program"
Option Explicit
Public Sub SelectTextFromTextBox(TextBox_Name As Control)
    TextBox_Name.SelStart = 0
    TextBox_Name.SelLength = Len(Trim(TextBox_Name.Text))
End Sub

Public Sub CheckValidNumberInputed(TextBox_Name As Control)
    If Not (Left(Trim(TextBox_Name.Text), 1) <> "-" And IsNumeric(TextBox_Name.Text)) Then
        Beep
        TextBox_Name.Text = Val(TextBox_Name.Text)
        TextBox_Name.SetFocus
    End If
End Sub

Public Sub CheckValidNumberWhileInput(KeyInput As Integer)
    If InStr(".-", Chr(KeyInput)) = 0 Then
        If KeyInput > 31 And (Chr(KeyInput) < "0" Or Chr(KeyInput) > "9") Then
            Beep
            KeyInput = 0
        End If
    End If
End Sub

Public Sub CheckValidNumberGT0WhileInput(KeyInput As Integer)
    ' Check number greater 0 while input
    If InStr(".", Chr(KeyInput)) = 0 Then
        If KeyInput > 31 And (Chr(KeyInput) < "0" Or Chr(KeyInput) > "9") Then
            Beep 'Warning Only
            KeyInput = 0
        End If
    End If
End Sub

Public Sub CheckNumericInputed(TextBox As Control)
    If Not IsNumeric(TextBox.Text) Then
        MsgBox "Please, Input a Decimal Number !", 0, " Error at number " & TextBox.Text
        TextBox.Text = Val(TextBox.Text)
        TextBox.SetFocus
        Exit Sub
    End If
End Sub

Public Sub CheckIntegerNumberWhileInput(KeyInput As Integer)
    ' Check an integer number while input
    If KeyInput > 31 And (Chr(KeyInput) < "0" Or Chr(KeyInput) > "9") Then
        Beep 'Warning Only
        KeyInput = 0
    End If
End Sub




